<?php
use yii\db\Schema;
use yii\db\Migration;

/**
 * 用户信息表，用户表的扩展表
 *
 * @author jois
 */
class m150828_054209_create_userinfo_table extends Migration
{

    public function up()
    {
        $this->createTable('userinfo', [
            'user_id' => Schema::TYPE_PK,
            'nickname' => Schema::TYPE_STRING,
            'qq' => Schema::TYPE_INTEGER . ' NOT NULL',
            'email' => Schema::TYPE_STRING . ' NOT NULL DEFAULT \'\'',
            'realname' => Schema::TYPE_STRING . ' NOT NULL DEFAULT \'\'',
            'last_time' => Schema::TYPE_INTEGER . ' NOT NULL',
            'last_ip' => Schema::TYPE_STRING . ' NOT NULL DEFAULT \'\'',
            'created_at' => Schema::TYPE_INTEGER . ' NOT NULL',
            'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL'
        ]);
        // $this->createIndex('userinfo_email_index', 'userinfo', 'email');
    }

    public function down()
    {
        $this->dropTable('userinfo');
    }
}
